﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _1_7 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Session["qiyeid"] = 2;
        //Session["ShenBaoNianDu"] = "2013";
        using (DataClassesDataContext mydata = new DataClassesDataContext())
        {
            var rd1 = from a in mydata.a01107_1
                      where a.qiyeid == Convert.ToInt32(Session["qiyeid"])
                      where a.DATA_MONTH == Convert.ToString(Session["ShenBaoNianDu"])
                      select a;
            foreach (var r in rd1)
            {
                PFK.Text = r.OUTPUT_NUMBER == null ? "" : Convert.ToString(r.OUTPUT_NUMBER);
                WSL.Text = r.YEAR_SUMCOUNT == null ? "" : string.Format("{0:#.####}", r.YEAR_SUMCOUNT);
                DBPFL.Text = r.REACH_CNT == null ? "" : string.Format("{0:#.####}", r.REACH_CNT);
                CBPFL.Text = r.OVER_CNT == null ? "" : string.Format("{0:#.####}", r.OVER_CNT);
                RHL.Text = r.INSEA_COUNT == null ? "" : string.Format("{0:#.####}", r.INSEA_COUNT);
                JHL.Text = r.INRIVER_COUNT == null ? "" : string.Format("{0:#.####}", r.INRIVER_COUNT);
                CSGW.Text = r.CITY_COUNT == null ? "" : string.Format("{0:#.####}", r.CITY_COUNT);
                WSC.Text = r.INFACT_COUNT == null ? "" : string.Format("{0:#.####}", r.INFACT_COUNT);
                QTQX.Text = r.OTHER_OUT == null ? "" : string.Format("{0:#.####}", r.OTHER_OUT);
            }

            Label[] lbWRW = new Label[] { this.WRW1, this.WRW2, this.WRW3, this.WRW4, this.WRW5};
            Label[] lbQCL = new Label[] { this.QCL1, this.QCL2, this.QCL3, this.QCL4, this.QCL5, this.QCL6, this.QCL7, this.QCL8, this.QCL9, this.QCL10, this.QCL11, this.QCL12, this.QCL13, this.QCL14, this.QCL15, this.QCL16 };
            Label[] lbXZQCL = new Label[] { this.XZQCL1, this.XZQCL2, this.XZQCL3, this.XZQCL4, this.XZQCL5, this.XZQCL6, this.XZQCL7, this.XZQCL8, this.XZQCL9, this.XZQCL10, this.XZQCL11, this.XZQCL12, this.XZQCL13, this.XZQCL14, this.XZQCL15, this.XZQCL16 };
            Label[] lbHJ = new Label[] { this.HJ1, this.HJ2, this.HJ3, this.HJ4, this.HJ5, this.HJ6, this.HJ7, this.HJ8, this.HJ9, this.HJ10, this.HJ11, this.HJ12, this.HJ13, this.HJ14, this.HJ15, this.HJ16 };
            Label[] lbDBL = new Label[] { this.DBL1, this.DBL2, this.DBL3, this.DBL4, this.DBL5, this.DBL6, this.DBL7, this.DBL8, this.DBL9, this.DBL10, this.DBL11, this.DBL12, this.DBL13, this.DBL14, this.DBL15, this.DBL16 };
            Label[] lbCBL = new Label[] { this.CBL1, this.CBL2, this.CBL3, this.CBL4, this.CBL5, this.CBL6, this.CBL7, this.CBL8, this.CBL9, this.CBL10, this.CBL11, this.CBL12, this.CBL13, this.CBL14, this.CBL15, this.CBL16 };

            
            var rd2 = from a in mydata.a01107_2
                      join c in mydata.CODE_POLLUTION_TABLE on a.CODE equals c.CODE
                      where a.qiyeid == Convert.ToInt32(Session["qiyeid"])
                      where a.DATA_MONTH == Convert.ToString(Session["ShenBaoNianDu"])
                      select new
                      {
                          c.NAME,
                          a.SRKXH,
                          a.DEAL_COUNT,
                          a.NEW_NUM,
                          a.YEAR_SUMCOUNT,
                          a.REACH_COUNT,
                          a.OVER_COUNT
                      };

            int i = 0;
            foreach (var r in rd2)
            {
                i = (int)r.SRKXH-1;
                if (i>=11)
                {
                    lbWRW[i -11].Text = r.NAME; 
                }
                lbQCL[i].Text = r.DEAL_COUNT == null ?  "" : string.Format("{0:#.####}", r.DEAL_COUNT);
                lbXZQCL[i].Text = r.NEW_NUM == null ? "" : string.Format("{0:#.####}", r.NEW_NUM);
                lbHJ[i].Text = r.YEAR_SUMCOUNT == null ? "" : string.Format("{0:#.####}", r.YEAR_SUMCOUNT);
                lbDBL[i].Text = r.REACH_COUNT == null ? "" : string.Format("{0:#.####}", r.REACH_COUNT);
                lbCBL[i].Text = r.OVER_COUNT == null ? "" : string.Format("{0:#.####}", r.OVER_COUNT);
            }

        }
    }
}